// DlgDevComn.cpp : implementation file
//

#include "stdafx.h"
#include "RFUsbDemo.h"
#include "DlgDevComn.h"

#include <winioctl.h>
//#include <hidpi.h>
//#include <hiddi.h>
#include "umfh.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//#pragma comment(lib,"usbhid.lib")

#define IOCTL_URF_READ  CTL_CODE(FILE_DEVICE_UNKNOWN, 0x08, METHOD_BUFFERED, FILE_READ_DATA)
#define IOCTL_URF_WRITE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x09, METHOD_BUFFERED, FILE_WRITE_DATA)


/////////////////////////////////////////////////////////////////////////////
// CDlgDevComn dialog


CDlgDevComn::CDlgDevComn(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgDevComn::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgDevComn)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDlgDevComn::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgDevComn)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgDevComn, CDialog)
	//{{AFX_MSG_MAP(CDlgDevComn)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgDevComn message handlers

void CDlgDevComn::OnButton1() //Beep
{

	int rel=fw_beep(icdev,10);

	if(!rel){
		AfxMessageBox(L"beep ok");

	}else{
		AfxMessageBox(L"beep error");
		RETAILMSG(1,(TEXT("Error id: %d\r\n"),rel));
	}

//	fw_exit(icdev);
//	icdev=INVALID_HANDLE_VALUE;
}
